import cv2

def upscale_image(image, scale_factor):
    height, width = image.shape[:2]
    new_height = int(height * scale_factor)
    new_width = int(width * scale_factor)
    upscaled_image = cv2.resize(image, (new_width, new_height), interpolation=cv2.INTER_CUBIC)
    return upscaled_image

# 读取原始图像
original_image = cv2.imread('../data/original_2023_07_19_21_37_38.png')

# 将图像放大2倍
scale_factor = 6
upscaled_image = upscale_image(original_image, scale_factor)
# 当前时间 yyyy-mm-dd-hh-mm-ss
import datetime
now = datetime.datetime.now()
# 转换为指定的格式:
otherStyleTime = now.strftime("%Y_%m_%d_%H_%M_%S")
# 保存放大后的图像
cv2.imwrite('../data/upscaled_image'+otherStyleTime+'.png', upscaled_image)